# -*- codeing = utf-8 -*-
# @Time : 2022/9/14 9:55
# @Author : 计科1814-16-徐澳
# @Software: PyCharm

infoTel ={}
print("\t\t\t欢迎使用个人通讯录系统")
print("\t\t1:查询联系人\t\t\t2:插入新的联系人")
print("3:删除已有联系人\t\t4:输出所有联系人信息\t\t5:退出")
orderList = ["1","2","3","4","5"]
while 1:
    order = input("\n\n请输入指令:")
    if order in orderList:
        if order == "1":
            name = input("请输入联系人姓名:")
            if name in infoTel:
                print(name,":",infoTel[name])
            else:
                print("查询的姓名不存在")
        if order == "2":
            name = input("请输入联系人姓名:")
            if name in infoTel:
                print("联系人已存在!!!")
            else:
                tel = input("请输入联系人电话:")
                infoTel[name] = tel
                print("插入成功!!!")
        if order == "3":
            name = input("请输入联系人姓名:")
            if name in infoTel:
                del infoTel[name]
                print("联系人已删除!!!")
            else:
                print("联系人不存在")
        if order == "4":
            for k,v in infoTel.items():
               print("姓名: %s\t\t电话: %s"%(k,v))
        if order == "5":
            print("感谢使用")
            break
    else:
        print("请输入正确的指令!!!")


